home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Utilities
/
BackSpace
/
Source
/
SleepView.m
< prev
next >
Wrap
Text File
|
1993-07-14
|
959b
|
46 lines
// SleepView.m
//
// You may freely copy, distribute, and reuse the code in this example.
// NeXT disclaims any warranty of any kind, expressed or implied, as to its
// fitness for any particular use.
// This view goes in a little 4 pixel window and cause BackSpace to sleep
// whenever the cursor goes to a preselected corner.
#import "Thinker.h"
#import "SleepView.h"
#import <libc.h>
#import <appkit/timer.h>
@implementation SleepView
- mouseEntered:(NXEvent *)theEvent
{
int looping = YES;
int doSaver = NO;
NXTrackingTimer myTimer;
NXBeginTimer(&myTimer, 3.0, 5.0);
while (looping)
{
theEvent = [NXApp getNextEvent: NX_TIMERMASK|NX_MOUSEEXITEDMASK];
switch (theEvent->type)
{
case NX_TIMER:
doSaver = YES;
// now fall into MOUSEEXITED code
case NX_MOUSEEXITED:
looping = NO;
break;
}
}
NXEndTimer(&myTimer);
if (doSaver) [BSThinker() showFakeScreenSaver:self];
return self;
}
@end